package java3_31;

import java.io.*;

/**
 * 2：附件 chaoxian.txt是个文本文件，用程序把其中的金正恩替换成 金三胖，
 *  提示：把内容取出来，替换后，写入文件。
 */
public class Homework1 {
    public static void main(String[] args) {
        try {
            BufferedReader br = new BufferedReader(new FileReader("G:\\JAVA84\\chaoxian1.txt"));
            BufferedWriter bw = new BufferedWriter(new FileWriter("G:\\JAVA84\\chaoxian2.txt"));
            String line = null;
             while ((line = br.readLine())!=null){
                 line = line.replaceAll("金正恩","金三胖");
                 bw.write(line);
                 bw.newLine();
             }
             br.close();
             bw.close();
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
}
